If you are developing an automated system for managing user accounts, a third party account management program, or would like to control user accounts through AppleScript, you can use AppleEvents to manipulate the Rumpus user database. The AppleEvents used to manage user accounts are, for the most part, straightforward, and the AppleScript samples below should make the process clear.
Note that all Rumpus user account management AppleEvents are of the class "FTPA". This class supports 5 different actions, described below, with the Event IDs: "RUDB", "GETL", "GETD", "ADDU" and "DELU".
Username <TAB> Password <TAB> DropFolder <TAB> PrivFlags <TAB> MaxFolderSize <CR>The username, password and drop folder fields are self explanatory. Note that the drop folder entry should be "ROOT" when the user is not assigned a drop folder and should be placed in the FTP root when logged in. The "MaxFolderSize" should be zero ("0") when the user is permitted unlimitted hard disk space. Otherwise, the value is simply the number of megabytes the user is allowed to use in their drop folder.
The "PrivFlags" field represents the user's access privileges. Each character of the field represents 1 privilege, with a value of "Y" representing "permission enabled" and "N" meaning that the user does not have the particular permission. The privileges are, in order:
If you are going to directly manipulate the Rumpus User Database file, we strongly urge you to create several user accounts using the built-in user interface, save the accounts, and open the User Database file in a text editor. You can then review the file directly, which should answer any questions you might have.
Once you have made changes to the User Database file, Rumpus can be forced to reload the updates without quitting and re-launching. This is done with the "Reload User DataBase" AppleEvent (or "RUDB"). For example, the following AppleScript, when run, will cause Rumpus to reload the database from the Rumpus User Database file on disk, causing any updates in the file to take effect immediately:
tell application "Rumpus 1.3" <<event FTPARUDB>> end tellImportant Note! The "Reload" event only needs to be sent when you have directly manipulated the Rumpus User Database file. When issuing the higher-level AppleEvents listed below that add and delete user accounts, changes automatically and immediately go into effect, without the need to force a reload.
tell application "Rumpus 1.3" <<event FTPAGETL>> end tell
When requesting user detail, you must specify the username of the account being requested. For example, to retrieve the complete account information for the user "John", use the AppleScript:
tell application "Rumpus 1.3" <<event FTPAGETD>> "John" end tellThis script might then return:
Username: John Password: moof DropFolder: ROOT MaxFolderSize: 0 RestrictToDropFolder: NO PermitLogin: YES PermitSeeFiles: YES PermitDownload: YES PermitUpload: YES PermitDelete: YES PermitCreateFolders: NO PermitDeleteFolders: NO
The account information is sent as a single text string, with each field labeled and delimitted by returns. Each field is made up of the field name, a colon, and the field value.
The fields "Username" and "Password" should be fairly obvious. The field values are plain text.
The "DropFolder" field is the plain text path to the user's assigned drop folder. If the user should be placed in the FTP root folder when logging in, use a value of "ROOT". The "MaxFolderSize" represents the maximum amount of hard disk space, in megabytes, the user can store in their drop folder.
The rest of the fields specify permissions. The possible values are "YES", which means "enable the permission" or "NO", which means the user does not have the permission specified. The permission fields are:
PERMISSION FIELD NAME | ALLOW USER TO... |
RestrictToDropFolder | climb out of drop folder? |
PermitLogin | log in? |
PermitSeeFiles | see directory listings? |
PermitDownload | download files? |
PermitUpload | upload files? |
PermitDelete | delete files? |
PermitCreateFolders | create folders? |
PermitDeleteFolders | delete folders? |
When defining a user, you will need to build a text string that includes each of the defined fields, and then send the string to Rumpus. For example, the following AppleScript will create a user account for the user "John":
tell application "Rumpus 1.3" set UserRecord to "Username: John" & return & "Password: moof" & return & "DropFolder: ROOT" & return & "MaxFolderSize: 0" & return & "RestrictToDropFolder: NO" & return & "PermitLogin: YES" & return & "PermitSeeFiles: NO" & return & "PermitDownload: YES" & return & "PermitUpload: NO" & return & "PermitDelete: YES" & return & "PermitCreateFolders: NO" & return & "PermitDeleteFolders: YES" & return <<event FTPAADDU>> UserRecord end tell
tell application "Rumpus 1.3" <<event FTPADELU>> "John" end tell
Copyright © 1997-9 Maxum Development Corporation
http://www.maxum.com/